<div id="visit">        
<% form_for(visit) do |f| %>
  <%= f.error_messages %>

<% if not edit %>

<div id="visit_reservation_select">  
  <%= f.label :visit_reservation, t(:reservation) %>
  <%= collection_select(:visit, :visit_reservation_id, visit_reservations, :id, :short_info, 
      options = {:prompt => t(:choose_reservation)}, 
  { :onChange => remote_function( :url => {:action => "visit_reservation_changed"}, :with => "'visit_reservation_id='+this.value")} ) 
  %>
</div>
<%= render :partial => "patient_select", :locals => {} %>

<% else %>

  <% if visit.visit_reservation %>
       <%= t(:reservation) + visit.visit_reservation.since.strftime(ApplicationHelper::DATETIME_FORMAT) %> ..
       		    <%=visit.visit_reservation.until.strftime(ApplicationHelper::TIME_FORMAT) %>
  <% end %>
  <br />
   <%=   t(:patient) + visit.patient.name %>
  <%= f.hidden_field :visit_reservation_id %>
  <%= f.hidden_field :patient_id %>
<% end %>


<%= render :partial => "visit_time_select", :locals => {:visit_since => visit_since, :visit_minutes => visit_minutes} %>

<br />
  <%= f.label :note, t(:note) %>
  <%= f.text_area :note %><br />
  <%= f.hidden_field :doctor_id %>
  <p>
    <%= f.submit button %>
  </p>
<% end %>
</div>

